package com.sunny.design.chain.auth.builderchain;


import com.sunny.design.chain.auth.Member;

public class MemberService {

    /**
     * 通过责任链构建执行流程
     */
    public void login(String loginName, String loginPass){
        Handler.Builder builder = new Handler.Builder();

        builder.addHandler(new ValidateHandler())
                .addHandler(new LoginHandler())
                .addHandler(new AuthHandler());

        Handler handler = builder.build();
        handler.doHandler(new Member(loginName,loginPass));
    }

}
